package com.yzd.learnjava.interfaces.interfaceprocessor;

import java.util.Arrays;

public abstract class StringProcessor implements Processor{
	public String name() {
		return getClass().getSimpleName();
	}
	
	public abstract String process(Object obj);
	
	public static String s = "If she weights the same as a duck, she has made of wood";
	
	public static void main(String[] args) {
		Apply.process(new UpCase(), s);
		Apply.process(new LowCase(), s);
		Apply.process(new Splitter(), s);
	}
}

class UpCase extends StringProcessor{
	public String process(Object obj) {
		return ((String)obj).toUpperCase();
	}
}

class LowCase extends StringProcessor{
	public String process(Object obj) {
		return ((String)obj).toLowerCase();
	}
}

class Splitter extends StringProcessor{
	public String process(Object obj) {
		return Arrays.toString(((String)obj).split(" "));
	}
}
